The Cost of Erasure in Java Generics Type System

نویسنده

  • Jaime Niño
چکیده

Java generics, found in versions 1.5 and later, are implemented by generating only one byte code representation of a generic type or method; a compiler maps all the instantiations of a generic type or method to that unique representation via type erasure. The essence of type erasure is the removal during compilation of all information that is related to type parameters and type arguments. From the point of view of the programmer, (s)he is left to negotiate a series of compiler and run-time errors that have little to do with programming errors but a lot to do with the Java generics implementation choice and leaving programmer sometimes with no choice but to live with unclean compiles.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

The Java 5 generics compromise orthogonality to keep compatibility

In response to a long-lasting anticipation by the Java community, version 1.5 of the Java 2 platform referred to as Java 5 introduced generic types and methods to the Java language. The Java 5 generics are a significant enhancement to the language expressivity because they allow straightforward composition of new generic classes from existing ones while reducing the need for a plethora of type ...

متن کامل

Automated Test Generation for Java Generics

Software testing research has resulted in effective white-box test generation techniques that can produce unit test suites achieving high code coverage. However, research prototypes usually only cover subsets of the basic programming language features, thus inhibiting practical use and evaluation. One feature commonly omitted are Java’s generics, which have been present in the language since 20...

متن کامل

Towards an Accurate Mathematical Model of Generic Nominally-Typed OOP

The construction of GNOOP as a domain-theoretic model of generic nominally-typed OOP is currently underway. This extended abstract presents the concepts of ‘nominal intervals’ and ‘full generification’ that are likely to help in building GNOOP as an accurate mathematical model of generic nominally-typed OOP. The abstract also presents few related category-theoretic suggestions. The presented co...

متن کامل

Type Safety of Generics for the .NET Common Language Runtime

The Microsoft .NET Common Language Runtime (CLR) offers support for generic types and methods. We develop a mathematical specification for the generics design through a type system and a model for the semantics of a subset of bytecode instructions with generics. We formalize the type-consistency checks performed for the subset by the CLR bytecode verifier. We then prove that adding support for ...

متن کامل

The Soundness of Component NextGen

This technical report presents a type soundness proof for Core CGen, a small, formal language designed for studying the addition of a component system based on genericity to a nominally typed objectoriented language supporting first-class generics. Core CGen captures the most intricate aspects of the Component NextGen programming language, an extension of the NextGen architecture that provides ...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2006